package com.nisco.dms.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.nisco.dms.entity.UserRole;
import com.nisco.dms.repository.UserRoleDao;

/**
 * 
 * @author joey
 * 
 */
// Spring Bean的标识.
@Component
// 默认将类中的所有public函数纳入事务管理.
@Transactional(readOnly = true)
public class UserRoleService extends BaseService<UserRole, String> {
	@Autowired
	private UserRoleDao userRoleDao;

	public UserRoleService() {

	}

	@Autowired
	public UserRoleService(UserRoleDao userRoleDao) {
		super((JpaRepository<UserRole, String>) userRoleDao);
		this.userRoleDao = userRoleDao;
	}

	public List<UserRole> find(String userId) {
		return userRoleDao.findByUserId(userId);
	}

}
